import request from '../axios/index';

/*
 * 描述：地域获取
 * 参数data: object  {areaId: string,keyWord:string,pageNum:string,pageSize:string}
 */
export function AccountSerach(id) {
    return request({
        method: 'post',
        url: '/api/manage/area/'+id,
    });
}

/*
 * 描述：获取admin
 * 参数data: object  {areaId: string,keyWord:string,pageNum:string,pageSize:string}
 */
export function GetAdmin(data){
    return request({
        method:'post',
        url:'/api/manage/admin/get',
        data:data
    })
}

/*
 * 描述：新建账号
 * 参数data: object  {fullName: 姓名, areaId:string,phone:string,roleId:array,username:账号,password:密码}
 */
export function SaveAdmin(data){
    return request({
        method:'post',
        url:'/api/manage/admin/save',
        data:data
    })
}

/*
 * 描述：修改账号
 * 参数data: object  {id: string, username: string,areaId:string,phone:string,roleId:array}
 */
export function UpdateAdmin(data){
    return request({
        method:'post',
        url:'/api/manage/admin/update',
        data:data
    })
}

/*
 * 描述：导出账号
 */
export function ExportAdmin(){
    return request({
        method:'post',
        url:'/api/manage/admin/export',
        responseType: 'blob'
    })
}

/*
 * 描述：删除账号
 * 参数data: object  {id:string}
 */
export function DeleteAdmin(id){
    return request({
        method:'post',
        url:'/api/manage/admin/delete/'+id
    })
}
//修改状态
export function updateStatus(data){
    return request({
        method:'post',
        url:'/api/manage/admin/updateStatusOrPassword',
        data:data
    })
}
//获取角色
export function getRoleSelections(){
    return request({
        method:'post',
        url:'/api/manage/role/getRoleSelections'
    }) 
}
